using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EventExample
{
    // 事件的响应者是事件的拥有者的一个成员  重要程度:无
    class Program
    {
        static void Main(string[] args)
        {
            Form form = new Form();
            Controller controller = new Controller(form);
            form.ShowDialog();
        }
    }
    // 2.事件的响应者
    class Controller
    {
        // 1.事件拥有者
        private Form form;
        public Controller(Form form)
        {
            if (form != null)
            {
                this.form = form;
                // 3.事件 += (4.事件订阅) 5.事件处理器
                this.form.Click += this.FormClicked;
            }
        }
        private void FormClicked(object sender, EventArgs e)
        {
            this.form.Text = "Controller.FormClicked:" + DateTime.Now.ToString();
        }
    }
}
